$(document).ready(function() {
    dataSource = new kendo.data.DataSource({
        data: appBosch.records
    });
    $("#grid").kendoGrid({
        toolbar: [
            {
                name: "excel",
                text: "Exportar a Excel"
            },
            {
                name: "pdf",
                text: "Exportar a PDF"
            }
        ],
        excel: {
            allPages: true,
            fileName: "Certificaciones eliminadas.xlsx",
            filterable: true
        },
        pdf: {
            allPages: true,
            fileName: "Certificaciones eliminadas.pdf"
        },
        scrollable: true,
        filterable: true,
        selectable: true,
        navigatable: true,
        resizable: true,
        columnMenu: true,
        sortable: true,
        groupable: true,
        dataSource: dataSource,
        columns: [
            {
                title: 'Detalles de la eliminación',
                columns: [
                    {
                        field: "full_name",
                        title: "Realizada por"
                    },
                    {
                        field: "log_creation_date",
                        title: "Fecha",
                        template: '<span title="#=kendo.toString(new Date(log_creation_date.replace(/-/g, "/")), "D")">#=kendo.toString(new Date(log_creation_date.replace(/-/g, "/")), "d")#</span>'
                    }
                ]
            },
            {
                title: 'Información de la certificación',
                columns: [
                    {
                        field: "moe",
                        title: "MOE"
                    },
                    {
                        field: "area",
                        title: "Área"
                    },
                    {
                        field: "line",
                        title: "Línea"
                    },
                    {
                        field: "workstation",
                        title: "Operación"
                    },
                    {
                        field: "asociado",
                        title: "Asociado"
                    },
                    {
                        field: "log_comment",
                        title: "Comentario"
                    }
                ]
            }
        ]
    });
});